import request from '@/utils/request'



// 获取企业信息
export function getCompanyInfo(params) {
  return request({
    url: '/company/list',
    method: 'get',
    params
  })
}


// 获取企业信息v2
export function getCompanyInfoV2(params) {
  return request({
    url: '/company/allList',
    method: 'get',
    params
  })
}

//回款计划（全部/企业...）
export function getPaymentPlanList(params) {
  return request({
    url: '/PaymentPlan/list',
    method: 'get',
    params
  })
}

// 根据tag获取文件列表
export function getFileByCompanyIdAndTag(params) {
  return request({
    url: '/Filing/getFileByCompanyIdAndTag',
    method: 'get',
    params
  })
}
// 通过合同编号查询企业信息 
export function getCompanyInfoByContractNumber(params) {
  return request({
    url: `/DraftContract/getCompanyInfoByContractNumber/${params.contractNumber}`,
    method: 'get',

  })
}
// 缴费流水查询 
export function getPaymentHistoryList(params) {
  return request({
    url: '/payment_history/list',
    method: 'get',
    params
  })
}
// 新增缴费·流水 
export function insertPaymentHistory(data) {
  return request({
    url: '/payment_history/insert',
    method: 'post',
    data
  })
}
// 修改缴费流水
export function updatePaymentHistory(data) {
  return request({
    url: '/payment_history/update',
    method: 'put',
    data
  })
}
// //删除 缴费流水
// export function deletePaymentHistory(data) {
//   return request({
//     url: '/payment_history/delete',
//     method: 'post',
//     data
//   })
// }
// 合同总表 
export function DraftContractList(params) {
  return request({
    url: '/DraftContract/list',
    method: 'get',
    params
  })
}
// 合同总表 新增（无回款计划）
export function DraftContractAllList(params) {
  return request({
    url: '/DraftContract/allList',
    method: 'get',
    params
  })
}
//缴费日志  查询
export function payment_logList(params) {
  return request({
    url: '/payment_log/list',
    method: 'get',
    params
  })
}
// id单独查询 
export function payment_logList_id(id) {
  return request({
    url: `/payment_log/getOneById/${id}`,
    method: 'get',

  })
}
// 修改 
export function updatePayment_log(data) {
  return request({
    url: '/payment_log/update',
    method: 'post',
    data
  })
}
// 回款缴费操作 
export function payment(data) {
  return request({
    url: '/payment_log/payment',
    method: 'post',
    data
  })
}
// 根据id查询单条回款计划 
export function getOneById(id) {
  return request({
    url: `/PaymentPlan/getOneById/${id}`,
    method: 'get',

  })
}
// 处于入驻中流程的企业 
export function selectPage(params) {
  return request({
    url: '/entryProcess/selectPage',
    method: 'get',
    params
  })
}
// 发起入驻中流程
export function insertEntryProcess(data) {
  return request({
    url: '/entryProcess/insert',
    method: 'post',
    data
  })
}
//合同状态改为待退用
export function DraftContract(contractNumber) {
  return request({
    //contractNumber 合同编号
    // url: `/DraftContract/pending-discard/${contractNumber}`,
    url: `/DraftContract/pending-discardToRedis/${contractNumber}`,

    method: 'put',

  })
}
//合同状态改为退用
export function DraftContractEnd(contractNumber) {
  return request({
    //contractNumber 合同编号
    // url: `/DraftContract/pending-discard/${contractNumber}`,
    url: `/DraftContract/discardToRedis/${contractNumber}`,

    method: 'put',

  })
}
// 创建准备办证
export function insertCertification(data) {
  return request({
    url: '/Certification/insert',
    method: 'post',
    data
  })
}
// 当前流程状态
export function selectById(id) {
  return request({
    url: `/entryProcess/selectById/${id}`,
    method: 'get',
  })
}
// 欠费回款计划
export function getArrearsList(params) {
  return request({
    url: '/PaymentPlan/arrearsList',
    method: 'get',
    params
  })
}
//创建飞书预审流程 
export function createFeiShuApprovalTask(data) {
  return request({
    url: `/DraftContract/createFeiShuApprovalTask`,
    method: 'post',
    data
  })
}

//创建飞书用印审批流程
export function createFeiShuSealTask(data) {
  return request({
    url: `/DraftContract/createFeiShuApprovalSealTask`,
    method: 'post',
    data
  })
}
// 押金转租金
export function transferDepositToRent(data) {
  return request({
    url: `/DraftContract/transferDepositToRent`,
    method: 'post',
    data
  })
}
// 释放房源
export function unbindRoom(data) {
  return request({
    url: '/room/unbindRoom',
    method: 'post',
    data
  })
}
// 退押金
export function depositRefund(data) {
  return request({
    url: `/payment_history/depositRefund`,
    method: 'post',
    data
  })
}
// 新旧合同押金转换
export function conversionDepositOldToNew(processId) {
  return request({
    url: `/DraftContract/conversionDepositOldToNew/${processId}`,
    method: 'PUT',
  })
}
// 退租及合同转换日志查询
export function cancellation_infoList(params) {
  return request({
    url: '/cancellation_info/list',
    method: 'get',
    params
  })
}
// 违约扣除押金 
export function defaultDeposit(data) {
  return request({
    url: `/payment_history/default`,
    method: 'post',
    data
  })
}
// 合同变更日志 
export function getChangeLog(params) {
  return request({
    url: '/entryProcess/getChangeLog',
    method: 'get',
    params
  })
}
// 入驻中流程中止
export function deleteEntryProcess(id) {
  return request({
    url: `/entryProcess/delete/${id}`,
    method: 'delete'
  })
}
// 删除缴费流水
export function deletePaymentHistory(id) {
  return request({
    url: `/payment_history/del/${id}`,
    method: 'delete'
  })
} 
// 获取会签人员列表
export function listForUser(params) {
  return request({
    url: '/system/user/listForUser',
    method: 'get',
    params
  })
}